<?php

namespace App\Http\Controllers\Api;

use App\Models\Renting;
use App\Models\Notice;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class NoticeController extends Controller
{
    //查看看房通知
    public function index(Request $request)
    {
        $openid = $request->input('openid');
        //根据openid转位租客id
        $renting_id = Renting::where('openid',$openid)->value('id');
        //查看此用户看放通知
        $data = Notice::where('renting_id',$renting_id)->with('owner')->orderBy('id','desc')->get();
        return $data;
    }
}
